From ced78b9748430165a891c41c2448a2ad5bd4cb88 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sun, 26 Oct 2008 13:57:19 +0000 Subject: [PATCH] API: (bug 16126) Added siprop=magicwords to meta=siteinfo --- RELEASE-NOTES | 1 + includes/api/ApiQuerySiteinfo.php | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c431f8478b..8f938c4d4e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -369,6 +369,7 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 16074) rvprop=content combined with a generator with a high limit causes an error * (bug 16105) Image metadata attributes containing spaces result in invalid XML +* (bug 16126) Added siprop=magicwords to meta=siteinfo === Languages updated in 1.14 === diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index b2d6da1f5b..e0d045fa6b 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -57,6 +57,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { case 'specialpagealiases': $this->appendSpecialPageAliases( $p ); break; + case 'magicwords': + $this->appendMagicWords( $p ); + break; case 'interwikimap': $filteriw = isset( $params['filteriw'] ) ? $params['filteriw'] : false; $this->appendInterwikiMap( $p, $filteriw ); @@ -164,6 +167,23 @@ class ApiQuerySiteinfo extends ApiQueryBase { $this->getResult()->setIndexedTagName( $data, 'specialpage' ); $this->getResult()->addValue( 'query', $property, $data ); } + + protected function appendMagicWords( $property ) { + global $wgContLang; + $data = array(); + foreach($wgContLang->getMagicWords() as $magicword => $aliases) + { + $caseSensitive = array_shift($aliases); + $arr = array('name' => $magicword, 'aliases' => $aliases); + if($caseSensitive) + $arr['case-sensitive'] = ''; + $this->getResult()->setIndexedTagName($arr['aliases'], 'alias'); + $data[] = $arr; + } + $this->getResult()->setIndexedTagName($data, 'magicword'); + $this->getResult()->addValue('query', $property, $data); + } + protected function appendInterwikiMap( $property, $filter ) { $this->resetQueryParams(); @@ -268,6 +288,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'namespaces', 'namespacealiases', 'specialpagealiases', + 'magicwords', 'interwikimap', 'dbrepllag', 'statistics', @@ -292,6 +313,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' "namespaces" - List of registered namespaces (localized)', ' "namespacealiases" - List of registered namespace aliases', ' "specialpagealiases" - List of special page aliases', + ' "magicwords" - List of magic words and their aliases', ' "statistics" - Returns site statistics', ' "interwikimap" - Returns interwiki map (optionally filtered)', ' "dbrepllag" - Returns database server with the highest replication lag', -- 2.20.1